package com.liuyjy.aop.controller;

/**
 * @Author liuyjy
 * @Date 2025/2/18 12:34
 * @Description: TODO
 **/

import com.liuyjy.aop.entity.UserReps;
import com.liuyjy.aop.entity.UserReq;
import com.liuyjy.aop.encryptDecrypt.EncryptDecrypt;
import com.liuyjy.base.common.util.ObjConvertUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/decrypt1")
@EncryptDecrypt
public class TestController {

    @PostMapping("/v1")
    @EncryptDecrypt
    public UserReps decrypt(@RequestBody UserReq userReq) {
        log.info("解密前对象：{},id={}", userReq, userReq.getId());
        UserReps convert = ObjConvertUtil.convert(userReq, UserReps.class);
        log.info("解密后对象：{},id={}", convert, convert.getId());
        return convert;
    }

}
